#!/bin/bash

set -o errexit
set -o pipefail
export LC_ALL=C

SYNC_DIR=$1
INPUT_DIR=$2
OUTPUT_DIR=$3

SRC_PATH=/home/mixagol/trunk/gene-class

while true; do
    fname=`${SRC_PATH}/tools/schedule_files.py $SYNC_DIR $INPUT_DIR`
    if [[ "x$fname" = "x" ]]; then
        break
    fi
    
    cat $INPUT_DIR/$fname | ${SRC_PATH}/3_raw_matrix_nw/simulation/nw_sim_process.py | gzip > $OUTPUT_DIR/.${fname}
    mv $OUTPUT_DIR/.${fname} $OUTPUT_DIR/${fname}
    
done
